package cn.hxzy.student.controller;

import cn.hxzy.common.domain.TaskManager;
import cn.hxzy.common.domain.vo.TaskManagerVo;
import cn.hxzy.common.response.R;
import cn.hxzy.student.service.TaskManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/TaskManager")
public class TaskMangaerController {
    @Autowired
    private TaskManagerService taskManagerService;

    @GetMapping("/GetTaskManagerList")
    public R<List<TaskManagerVo>> GetTaskManagerList(){
        return R.success(taskManagerService.GetTaskManagerList());
    }

    @GetMapping("/getClassIdByList")
    public R<List<TaskManagerVo>> getClassIdByList(@RequestParam Integer classId){
        List<TaskManagerVo> classIdByList = taskManagerService.getClassIdByList(classId);
        return R.success(classIdByList);
    }

    @PostMapping("/updateTaskManger")
    public R updateTaskManger(@RequestBody TaskManager taskManager){
        taskManager.setApprovalStatus(0);
        boolean b = taskManagerService.updateById(taskManager);
        return R.success("修改成功");
    }

}
